<!DOCTYPE html >
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>系统密码维护</title>

    <link rel="stylesheet" type="text/css" href="../../../static/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="../../../static/fonts/line-icons.css">
    <link href="../../../static/plugins/datatables/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css" />
    <link href="../../../static/plugins/datatables/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css" />
    <link href="../../../static/plugins/datatables/responsive.bootstrap4.min.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../../..//static/css/main.css">
    <link rel="stylesheet" type="text/css" href="../../..//static/css/responsive.css">

</head>
<body>
<div class="app header-default side-nav-dark">
    <div class="layout">
        <!--顶部栏-->
        <div th:replace="~{/topbar::topbar}">
        </div>

        <!--侧边栏-->
        <div th:replace="~{/sidebar::sidebar}">

        </div>
        <!--主体部分-->
        <div class="page-container">

            <div class="main-content">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="card">
                                <div class="card-header border-bottom">
                                    <h3 class="text-center">
                                        系统密码维护
                                    </h3>
                                    <!--<span class="badge badge-default">用户注册</span>-->
                                </div>
                                <div class="card-body">
                                    <form id="form" onsubmit="return f()">
                                        <div class="form-group">
                                            <label for="Userid">
                                                用户名:
                                            </label>
                                            <label th:text="${user.name}">xxx</label>
                                            <input type="hidden" name="Userid" id="Userid" th:value="${user.id}">
                                        </div>
                                        <div class="form-group">
                                            <label for="OldPassword">
                                                旧密码:
                                            </label>
                                            <input type="password" class="form-control" id="OldPassword" name="oldPassword" />
                                        </div>
                                        <div class="form-group">

                                            <label for="PaperUnit">
                                                新密码:
                                            </label>
                                            <input type="password" class="form-control" id="PaperUnit" name="password" />
                                        </div>
                                        <div class="form-group">

                                            <label for="PaperFirstAuther">
                                                确认密码:
                                            </label>
                                            <input type="password" class="form-control" id="PaperFirstAuther" name="password2" />
                                        </div>
                                        <div class="controls d-flex justify-content-center ">
                                            <button type="submit" class="btn btn-common">
                                                提交
                                            </button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <footer class="content-footer">
                <!--<div th:replace="~{/footer::footer}"></div>-->
                <div class="footer" th:fragment="footer">
                    <div class="copyright">
                        <span>Copyright © 2019 <b class="text-dark">UIdeck</b>. All Right Reserved More Templates <a href="http://www.scnoob.com">model</a> - Collect from <a href="http://www.scnoob.com/moban">team 5</a></span>

                    </div>
                </div>
            </footer>

        </div>

    </div>
</div>
</div>
<script src="../../../static/js/jquery-min.js"></script>
<script src="../../..//static/js/popper.min.js"></script>
<script src="../../../static/js/bootstrap.min.js"></script>
<script src="../../../static/js/scripts.js"></script>
<script src="../../../static/js/jquery.app.js"></script>
<script src="../../../static/js/main.js"></script>

<script src="../../../static/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="../../../static/plugins/datatables/dataTables.bootstrap4.min.js"></script>

<script src="../../../static/plugins/datatables/dataTables.buttons.min.js"></script>
<script src="../../../static/plugins/datatables/buttons.bootstrap4.min.js"></script>
<script src="../../../static/plugins/datatables/jszip.min.js"></script>
<script src="../../../static/plugins/datatables/pdfmake.min.js"></script>
<script src="../../../static/plugins/datatables/vfs_fonts.js"></script>
<script src="../../../static/plugins/datatables/buttons.html5.min.js"></script>
<script src="../../../static/plugins/datatables/buttons.print.min.js"></script>
<script src="../../../static/plugins/datatables/buttons.colVis.min.js"></script>

<script src="../../../static/plugins/datatables/dataTables.responsive.min.js"></script>
<script src="../../../static/plugins/datatables/responsive.bootstrap4.min.js"></script>

<script src="../../../static/js/datatables.init.js"></script>

<script type="text/javascript">
    function f() {
        var formData = new FormData($('#form')[0]);
        $.ajax({
            url:"/user/modifyPW",
            type:"post",
            data:formData,
            processData:false,
            contentType:false,
            success:function (result) {
                if (result && result.success) {
                    alert("提交成功");
                    window.location.href = "/home";
                } else {
                    alert(result.msg);
                }
            }
        });
        return false;
    }
</script>
</body>
</html>
